#pragma once

#include <Windows.h>
#include <map>
#include <list>
#include <set>
#include <gdiplus.h>

class ScreenThumbnailHelper;

#include "Utilities.h"

using namespace std;
using namespace Gdiplus;

class ScreenThumbnailHelper
{
public:
	ScreenThumbnailHelper(HWND hWnd);
	~ScreenThumbnailHelper();


	//Image* CreateScreenshot(set<HWND> windowsToInclude, POINT offset, RECT rect);
	void CreateSimulatedScreenThumbnail(set<HWND> windowsToInclude, POINT screenOffset, RECT rect);
	void DestroySimulatedScreenThumbnail();
private:
	void RefreshScreenThumbnailAreaData(RECT rect);

	HWND hWnd;
	set<HWND> windowsToInclude;
	list<HWND> windows;
	list<HTHUMBNAIL> hThumbnails;
	double FactorX;
	double FactorY;

	//Image* CaptureWindow(HWND hWnd);
	//Image* CaptureWindow(HWND hWnd, Size s);

	static int virtualscreenXOffset;
	static int virtualscreenYOffset;
	static map<HWND, ScreenThumbnailHelper*> instances;


	static BOOL CALLBACK EnumDisplayMonitorsProc(HMONITOR hMonitor, HDC hdc, LPRECT lpRect, LPARAM lParam);
	static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
};

